# 下载sherpa
if [ ! -f "sherpa-onnx-v1.10.38-linux-x64-static.tar.bz2" ]; then
  wget https://github.com/k2-fsa/sherpa-onnx/releases/download/v1.10.38/sherpa-onnx-v1.10.38-linux-x64-static.tar.bz2
fi
if [ ! -d "sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  tar xvf sherpa-onnx-v1.10.38-linux-x64-static.tar.bz2
fi
if [ ! -d "models/sherpa_zipformer_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_zipformer_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_zipformer_small_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_zipformer_small_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_sensevoice_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_sensevoice_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_paraformer_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_paraformer_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi

if [ ! -d "models/sherpa_zipformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_zipformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_zipformer_small_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_zipformer_small_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_sensevoice_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_sensevoice_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi
if [ ! -d "models/sherpa_paraformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static" ]; then
  cp -r sherpa-onnx-v1.10.38-linux-x64-static models/sherpa_paraformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static
fi

# 下载模型
# zipformer
if [ ! -f "sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2" ]; then
  wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2
fi
if [ ! -d "sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20" ]; then
  tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2
fi
if [ ! -d "models/sherpa_zipformer_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20" ]; then
  cp -r sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 models/sherpa_zipformer_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
fi
if [ ! -d "models/sherpa_zipformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20" ]; then
  cp -r sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 models/sherpa_zipformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
fi
# zipformer-small
if [ ! -f "sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16.tar.bz2" ]; then
  wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16.tar.bz2
fi
if [ ! -d "sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16" ]; then
  tar xvf sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16.tar.bz2
fi
if [ ! -d "models/sherpa_zipformer_small_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16" ]; then
  cp -r sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16 models/sherpa_zipformer_small_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16
fi
if [ ! -d "models/sherpa_zipformer_small_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16" ]; then
  cp -r sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16 models/sherpa_zipformer_small_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-zipformer-small-bilingual-zh-en-2023-02-16
fi
# sensevoice
if [ ! -f "sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2" ]; then
  wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2
fi
if [ ! -d "sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17" ]; then
  tar xvf sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2
fi
if [ ! -d "models/sherpa_sensevoice_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17" ]; then
  cp -r sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17 models/sherpa_sensevoice_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17
fi
if [ ! -d "models/sherpa_sensevoice_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17" ]; then
  cp -r sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17 models/sherpa_sensevoice_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17
fi
# parafomer
if [ ! -f "sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2" ]; then
  wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2
fi
if [ ! -d "sherpa-onnx-streaming-paraformer-bilingual-zh-en" ]; then
  tar xvf sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2
fi
if [ ! -d "models/sherpa_paraformer_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-paraformer-bilingual-zh-en" ]; then
  cp -r sherpa-onnx-streaming-paraformer-bilingual-zh-en models/sherpa_paraformer_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-paraformer-bilingual-zh-en
fi
if [ ! -d "models/sherpa_paraformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-paraformer-bilingual-zh-en" ]; then
  cp -r sherpa-onnx-streaming-paraformer-bilingual-zh-en models/sherpa_paraformer_int8_zh/sherpa-onnx-v1.10.38-linux-x64-static/sherpa-onnx-streaming-paraformer-bilingual-zh-en
fi